﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Audio;
using System.Linq;
using System.Text;

namespace VRB_0._1
{
    class OptionsScreen
    {
        public enum OptionsChoice
        {
            TOGGLE_MUSIC = 1, BACK = 2
        }

        protected SpriteFont font;
        protected OptionsChoice currentChoice;
        protected Texture2D selector;
        protected Texture2D background;

        protected SoundEffect back;
        protected SoundEffect choose;

        public void Initialize(ContentManager Content)
        {
            font = Content.Load<SpriteFont>("gameFont");
            selector = Content.Load<Texture2D>("selector");
            background = Content.Load<Texture2D>("meny");

            back = Content.Load<SoundEffect>("back");
            choose = Content.Load<SoundEffect>("choice");

            currentChoice = OptionsChoice.TOGGLE_MUSIC;
        }

        public void Draw(SpriteBatch spriteBatch, Viewport Viewport)
        {
            spriteBatch.Draw(background, Vector2.Zero, Color.White);
            spriteBatch.DrawString(font, "Toggle music",
                        new Vector2(Viewport.TitleSafeArea.X + 50, Viewport.TitleSafeArea.Y + 200), Color.White);
            spriteBatch.DrawString(font, "Back",
                        new Vector2(Viewport.TitleSafeArea.X + 50, Viewport.TitleSafeArea.Y + 250), Color.White);
            spriteBatch.Draw(selector, new Vector2(Viewport.TitleSafeArea.X + 15, Viewport.TitleSafeArea.Y + 155 + 50 * (int)currentChoice), Color.White);
        }

        public void InputUp()
        {
            if ((int)currentChoice != 1)
            {
                choose.Play();
                currentChoice--;
            }
        }
        public void InputDown()
        {
            if ((int)currentChoice != 2)
            {
                choose.Play();
                currentChoice++;
            }
        }
        public OptionsChoice InputSelect()
        {
            OptionsChoice temp = currentChoice;
            currentChoice = OptionsChoice.TOGGLE_MUSIC;
            return temp;
        }
        public void InputEsc()
        {
            currentChoice = OptionsChoice.TOGGLE_MUSIC;
            back.Play();
        }
    }
}
